<?php
require('./model/_connect.php');
header("Access-Control-Allow-Origin:*"); // 允许哪些域名请求我
header("Access-Control-Request-Methods:GET, POST, PUT, DELETE, OPTIONS"); // 允许哪些请求方式
header('Access-Control-Allow-Headers:x-requested-with,content-type,test-token,test-sessid'); // 允许携带哪些请求头信息
//书写sql语句
$sql = "SELECT * FROM cart";
//执行sql语句
$result = mysqli_query($conn,$sql);
if($result){	
	$arr = mysqli_fetch_all($result,MYSQL_ASSOC);
	echo json_encode(array("code"=>1,"data"=>$arr));
}else{	
	echo json_encode(array("code"=>0));
}


?>